<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ca="http://java.sun.com/jsf/composite/cashSummery"                
                xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:define name="content">
        <h:outputStylesheet library="css" name="printing.css"></h:outputStylesheet>

        <h:form id="panelPrint">

            <h:outputStylesheet library="css" name="printing.css"></h:outputStylesheet>
            <p:panel>
                <f:facet name="header" >
                    <h:outputLabel value="Item List"  styleClass="noPrintButton" />
                    <h:panelGrid columns="2"  styleClass="noPrintButton" id="pan">
                        <h:outputLabel value="From Date"/>
                        <p:calendar id="frmDate" value="#{quickBookReportController.fromDate}" navigator="true"  
                                    pattern="dd MM yyyy" />
                        <h:outputLabel value="To Date" />
                        <p:calendar id="toDate" value="#{quickBookReportController.toDate}" navigator="true"  
                                    pattern="dd MM yyyy"/>
                    </h:panelGrid>

                    <h:panelGrid columns="5">
                        <p:spacer width="110" height="1"/>
                        <p:commandButton value="Refresh" ajax="false"  styleClass="noPrintButton" style="float: right;"
                                         action="#{quickBookReportController.createAllBilledItemReport()}"/>
                        <p:commandButton ajax="false" value="Print"  styleClass="noPrintButton" style="float: right;"  >
                            <p:printer target="panelPrint" />
                        </p:commandButton>
                        <p:commandButton value="Excel" ajax="false" styleClass="noPrintButton" style="float: right;">
                            <!--<p:dataExporter type="csv" target="tbl" fileName="QB_Export"/>-->
                            <pe:exporter type="xlsx" target="tbl" fileName="QB_Export_Item_List"/>
                        </p:commandButton>
                    </h:panelGrid>


                </f:facet>
            </p:panel>

            <p:panel styleClass="noBorder summeryBorder">
                <p:dataTable id="tbl" value="#{quickBookReportController.items}" var="i" >
                    <p:columnGroup  type="header">
                        <p:row>
                            <p:column headerText="!INVITEM"/>
                            <p:column headerText="NAME" />
                            <p:column headerText="REFNUM" />
                            <p:column headerText="TIMESTAMP" />
                            <p:column headerText="INVITEMTYPE" />
                            <p:column headerText="DESC" />
                            <p:column headerText="ACCNT" />
                        </p:row>
                    </p:columnGroup> 
                    <p:column>
                        <p:outputLabel value="INVITEM" />
                    </p:column>
                    <p:column>
                        <p:outputLabel value="#{i.category}:#{i.transName}" />
                    </p:column>
                    <p:column>
                        <p:outputLabel value="" />
                    </p:column>
                    <p:column>
                        <p:outputLabel value="" />
                    </p:column>
                    <p:column>
                        <p:outputLabel value="SERV" />
                    </p:column>
                    <p:column>
                        <p:outputLabel value="" />
                    </p:column>
                    <p:column sortBy="#{i.category.description}">
                        <p:outputLabel value="#{i.category.description}" />
                    </p:column>
                </p:dataTable>
            </p:panel>
        </h:form>
    </ui:define>

</ui:composition>

